package com.yazi.mxz.fieldsale.controller;

import java.util.List;

import javax.annotation.Resource;

import com.yazi.mxz.fieldsale.common.Config;
import com.yazi.mxz.fieldsale.entity.beans.Version;
import com.yazi.mxz.fieldsale.repository.VersionRepository;

/**
 * 
 * @author mo_yq5
 * @date 2015-6-13
 */
public class BaseController {
	
	@Resource
	VersionRepository versionRepository;
	
	protected Version getVersion() {
		List<Version> list = versionRepository.findAll();
		Version version;
		if (list.size() == 0) {
			version = new Version();
		} else {
			version = list.get(0);
		}
		version.setEnvVersion(Config.getInstance().getVersion());
		version.setWarVersion("1.1.0.07111");// TODO 配置项:当前程序版本
		version.setReset(true);// TODO 配置项:是否要求用户重置数据
		return version;
	}
}
